package com.chennan.design.factory.simple;
/**
 * pizza 销售商店
 * @author chennan
 *
 */

import com.chennan.design.factory.simple.inteface.Pizza;
import com.chennan.design.factory.simple.type.PizzaType;

public class PizzaStore {

	SimpleFactory factory;
	
	public PizzaStore(SimpleFactory factory) {
		this.factory=factory;
	}
	
	public Pizza orderPizza(PizzaType type) {
		Pizza pizza=this.factory.createPizza(type);
		pizza.prepare();
		pizza.bake();
		pizza.cut();
		pizza.box();
		return pizza;
	}
	
	public static void main(String[] args) {
		//简单工厂
		PizzaStore store=new PizzaStore(new SimpleFactory());
		System.out.println(store.orderPizza(PizzaType.GREEK));
	}
}
